<!DOCTYPE html>
<html>
<head>
	<title></title>
	
	<script src="/static/incubator-echarts-4.2.1/incubator-echarts-4.2.1/dist/echarts.min.js"></script>
	<script src="/static/incubator-echarts-4.2.1/incubator-echarts-4.2.1/dist/echarts.js"></script>
	<script type="text/javascript" src="/static/jquery-3.3.1.min.js"></script>
</head>
<body>
	 <div id="main" style="width: 600px;height:400px;"></div>
	 <script type="text/javascript">
	 	 var myChart = echarts.init(document.getElementById('main'));

        // 指定图表的配置项和数据
     
     myChart = echarts.init(document.getElementById('main'));

        var arr1=[],arr2=[];
              function arrTest(){
                $.ajax({
                  type:"post",
                  data:{data:'111'},
                  url:"/backend/graph/data",
                 async:false,
                  dataType:"json",
                  success:function(result){
                    console.log('111');
                    if (result) {
                      for (var i = 0; i < result.length; i++) {
                          //arr1.push(result[i].day);
                          arr2.push(result[i].amount);
                      }
                    }
                    //console.log(arr1);
                    console.log(arr2);
                  }
                });
                return arr2;
                
              }
              arrTest();
    

        // 指定图表的配置项和数据
       var option = {
            title: {
                text: 'ECharts 入门示例'
            },
            tooltip: {},
            legend: {
               
            },
            xAxis: {
                
                data:['景点','酒店','餐厅']
            },
            yAxis: {
                
            },
            series: [{
                    name:'result',
                    type:'line',
                    data:arr2
            },

             {
                 name: 'aaa',
            type: 'bar',
           
            data: [98, 66, 100,150,500]
        }
            ]

        };

        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
	 </script>

</body>
</html>